<?php
class User extends CI_Model
{ 
	function __construct()
	{
		parent::__construct();
		
	}
	function login()
	{
		if(isset($_POST['username']))
		{
			$this->db->where('username',$_POST['username']);
			$query = $this->db->get('users');
			if($query->num_rows()>0)
			{
				$row=$query->row_array();
				if($row['password']==$_POST['password'])
				{
					return $row['username'];
				}
			}
		}
		return false;
	}
	
	//gio viet ham lay danh sach user chang han
	function get_users()
	{
		$this->db->select('*');
		$query = $this->db->get_where('users');
		return $query;
	}
	
}
?>